Create a FIFO QueueΒΆ
Q = queue.Queue()
Q.put(str(i))
Q.get()
Create a FIFO Queue.
Expected output:
0 1 2 3
import queue
Q = queue.Queue()
# insert items at the end of the queue
for i in range(4):
Q.put(str(i))
# remove items from the head of the queue
while not Q.empty():
print(Q.get(), end=" ")
Output:
0 1 2 3